package com.lnsf.bookstore.common.enums;

public enum OrderStatus {
    DAICHULI(0,"待处理"),
    DAIFUKUAN(1,"待付款"),
    DAIFAHUO(2,"待发货"),
    YIFAHUO(3,"已发货"),
    WANCHENG(4,"完成"),
    TUIKUANZHONG(5,"退款中"),
    YITUIKUAN(6,"已退款"),
    DAISHOUHUO(7,"待收货");


    private int value;
    private String text;

    private OrderStatus(int value, String text) {
        this.value = value;
        this.text = text;
    }

    public static OrderStatus valueOf(int statusCode) {
        for (OrderStatus status : values()) {
            if (status.value == statusCode) {
                return status;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
    }

    public int toValue(){
        return value;
    }

    public String toText() {
        return text;
    }


    @Override
    public String toString() {
        return Integer.toString(value);
    }
}
